<template>
  <div>
    <div v-if="auth=='1'">
      <!--<index-chart></index-chart>-->
      <home-page></home-page>
    </div>
    <div v-if="auth=='2'">
      <!--<index-bdc ></index-bdc>-->
      <!--<index-task></index-task>-->
      <!--<index-chart></index-chart>-->
      <home-page></home-page>
    </div>
    <div v-if="auth=='3'">


      这是车信盟企业服务系统，您当前不属于任何已备案企业，如果您属于某个集团请您联系相关集团负责人先完成企业备案。
    </br>
      如您属于独立经营体，请填写下面表单信息完成备案。

      <cxm-enterprise-modal ></cxm-enterprise-modal>
    </div>
    <!--<index-chart v-if="indexStyle==1"></index-chart>
    <index-bdc v-if="indexStyle==2"></index-bdc>
    <index-task v-if="indexStyle==3"></index-task>-->
    <!--<div style="width: 100%;text-align: right;margin-top: 20px">
      请选择首页样式：
      <a-radio-group v-model="indexStyle">
        <a-radio :value="1">监测图表</a-radio>
        <a-radio :value="2">监测图表2</a-radio>
        <a-radio :value="3">任务表格</a-radio>
      </a-radio-group>
    </div>-->

  </div>
</template>

<script>
  import HomePage from './HomePage'
  import IndexChart from './IndexChart'
  import IndexTask from "./IndexTask"
  import CxmEnterpriseModal from '../cxm/modules/CxmEnterpriseModal'
  import IndexBdc from './IndexBdc'
  import { getAction } from '@/api/manage'
  import Vue from 'vue'
  import { ACCESS_TOKEN, USER_NAME,USER_INFO,USER_AUTH,SYS_BUTTON_AUTH,UI_CACHE_DB_DICT_DATA,TENANT_ID } from "@/store/mutation-types"

  export default {
    name: "Analysis",
    components: {
      HomePage,
      IndexChart,
      IndexTask,
      IndexBdc,
      CxmEnterpriseModal
    },
    data() {
      return {
        indexStyle:1,
        menu:[],
        auth:''

      }
    },

    mounted() {
      this.handleOk();
    },

    created() {

    },
    methods: {
      handleOk (){
        const that = this
        let token = Vue.ls.get(ACCESS_TOKEN);
        let httpurl = '/sys/permission/getUserPermissionByToken';
        getAction(httpurl, {token: token}).then((res)=>{
        if(res.success){
          this.menu= res.result.menu
          for(let me in res.result.menu){
            if(res.result.menu[me].name=='ADMINHOME'){
              this.auth='1'
            }
            if(res.result.menu[me].name=='QYYHHOME'){
              this.auth='2'
            }
            if(res.result.menu[me].name=='GRYHHOME'){
              this.auth='3'
            }
          }
        }else{
          that.$message.warning(res.message);
        }
      })
      }
    }
  }
</script>